package org.jwcloud.project.module.zx.timingAnalyse.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.jwcloud.project.module.zx.common.FmtUtil;
import org.jwcloud.project.module.zx.common.Resp;
import org.jwcloud.project.module.zx.timingAnalyse.service.repository.TimingAnalyseRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TimingAnalyseServiceImpl implements TimingAnalyseService{

	@Autowired
    public TimingAnalyseRepository timingAnalyseRepository;
	
	@Override
	public Resp<Object> queryTitleData(Map param) {
		// TODO Auto-generated method stub
		return Resp.success(this.timingAnalyseRepository.queryTitleData(param));
	}

	@Override
	public Resp<Object> queryStepBar(Map param) {
		// TODO Auto-generated method stub
		return Resp.success(FmtUtil.buildResCommon(this.timingAnalyseRepository.queryStepBar(param)
				, "vdesc", "app_phase_desc"
				, "value", "warn_num"));
	}

	@Override
	public Resp<Object> queryDeptPie(Map param) {
		// TODO Auto-generated method stub
		return Resp.success(this.timingAnalyseRepository.queryDeptPie(param));
	}

	@Override
	public Resp<Object> queryFiveYearLine(Map param) {
		// TODO Auto-generated method stub
		
		return Resp.success(FmtUtil.buildResCommon(this.timingAnalyseRepository.queryFiveYearLine(param)
				, "vdesc", "year_flag"
				, "warn1_num", "warn1_num"
				, "warn2_num", "warn2_num"));
	}

	@Override
	public Resp<Object> queryProBar(Map param) {
		// TODO Auto-generated method stub
		
		Map res = FmtUtil.buildResCommon(this.timingAnalyseRepository.queryProBar(param)
				, "vdesc", "project_name"
				, "warn1", "warn1_num"
				, "warn2", "warn2_num");
		List list = new ArrayList();
		list.add("一次预警");
		list.add("二次预警");
		res.put("title", list);
		
		return Resp.success(res);
		
		//return Resp.success(this.timingAnalyseRepository.queryProBar(param));
	}

	@Override
	public Resp<Object> queryYearLine(Map param) {
		// TODO Auto-generated method stub
		
		Map res = FmtUtil.buildResCommon(this.timingAnalyseRepository.queryYearLine(param)
				, "vdesc", "month_num"
				, "warn1", "warn1_num"
				, "warn2", "warn2_num");
		List list = new ArrayList();
		list.add("一次预警");
		list.add("二次预警");
		res.put("title", list);
		
		return Resp.success(res);
		
//		return Resp.success(this.timingAnalyseRepository.queryYearLine(param));
	}

}
